﻿package com.kx.config;

import org.springframework.context.annotation.Configuration;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */
public class AlipayConfig {

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2021000119658008";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCPOzpEeotRHMybzipTCsPyoE9zPa7oI8VjiK3WOuAzHlc977V2bEEE1VRA2UYLanlrKwkWHw6jZDAYDe6OP3VAO2aZGdZHhh5BkJUTTajOObWiPUTvVUohqVrMCMVpbiPp9sJYnwmMLjbUJyPoyNtWlW9KGjAmmZADOpgsrOyx7vAOjB2TLRPhxycH23UJmqaGJIn6TYMLkoYyOxLV6Lxe5HnePbTnxeajnD9VTq0E1R+qx71EgxDuqNuRzt9B25lCW5qdbtya/xx+h87Tm5JTKRqPcXjDsY4AtXNp+VNw0PzUt53y8VTKL9KsY3i39SzqtQvQcHKS7jZ9cibNnxPDAgMBAAECggEAWb7au52tPZ219sovaukL7jLUlXjI51vCiqNRiTJK2LziHUTdht49vzGMITYC1ZRZj/TfNKUxHt/f4rKYDzlj1mNh3fx6b0ZyHtLhFb9LTiyKyqVpVC00zfK3mbDFQVJp3mdnTvAXo2YxpK0BqxJvnMj1epD+KrF9swg74YJYrQP//22FdzgsfDev8KOSzCGY0Z/38+M//uuXu8mRk/yv2emCTlgLurwS9FZvBBsewAq75mgnv+lV5OJ4AYH0QNxTIagWailyeKjROuV1ytoRyYoaxbqxHxMNBJGdYHoOPO134SKcGfCFQEmoJPpSs7okxsm2h48+AmrRJCqKcod3QQKBgQDat5HacnWNb1fMBIr9dgykfkTWauzk/cOhRGImzGLGKTQagSfCnndFlKybT2sEHBwEyqqC4OZgK5QNg0vIuW4ANXgYt1xtmsO3alyWsg8nbrGUFIKesHq8PfH02V6ub0RDkaLTFKKD0lMwSFStiwE7XWa4tj/2tRjQOV1YRbqgfwKBgQCnpZfuacvM8MnAASXak61MLCB6IbxcNSLKJqUeuUmw2DfAnhsezlIVtadz+qeLagkTyUv4jkwCUOs62wfQpI2Xd4w6hBJa1sRJE6DdwjEFRyRcCfxTKBXHFxuoi5IGQ/U6cVki3dSIJebbDjXYtBRbrTv86ca3tEivPK1UAp5qvQKBgQCsqz3HgpNRbHSYyYFdJoRGnLUFvfZ1te1q9Iy0aqkUHlVXE13rZKVu1jgKiQFIhlSMZ9+DYcAebmj83gnHVrUEDzJX+PJMSWF3/M1J3xrdm6Mv751LYLIUyKarEayQ86Cl42TzVZgTj8lDFedb9qCrWEqPSrpmr4P+ZztNRAdZSwKBgC7C2aX+jIIVh7CuoUheeLAOfuCSGF//0jxgmx3+wLc7GBH6B8aH9g1oJdULzT/ty6phM3eY+UqMF5DLF1rzCyt8hPitbhE4Znebqfsw90tplJK3llH7lFd78pMImyp0OiqbAynehjGToNjpFcvkLumDYIAjFPKYrs1yN0Z/lIBhAoGBAKc6Gz7DGoQ5+4BY7LDEf9T6le8hpT+EHF5zRPY+y+75HCHLyi7gGWwgiHF4f2inTG+LbUZl+xnzvhgVM8hFUpJvkuQBD55mIgZiYKrh2F6XR6Bn/qy75ZuGabVobD94ydqmztRz/p9u4RlKOwlPVj3fX4LKoM6bkceCvjrxzI28";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjzs6RHqLURzMm84qUwrD8qBPcz2u6CPFY4it1jrgMx5XPe+1dmxBBNVUQNlGC2p5aysJFh8Oo2QwGA3ujj91QDtmmRnWR4YeQZCVE02ozjm1oj1E71VKIalazAjFaW4j6fbCWJ8JjC421Ccj6MjbVpVvShowJpmQAzqYLKzsse7wDowdky0T4ccnB9t1CZqmhiSJ+k2DC5KGMjsS1ei8XuR53j2058Xmo5w/VU6tBNUfqse9RIMQ7qjbkc7fQduZQluanW7cmv8cfofO05uSUykaj3F4w7GOALVzaflTcND81Led8vFUyi/SrGN4t/Us6rUL0HByku42fXImzZ8TwwIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
//	public static String notify_url = "http://工程公网访问地址/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";
    public static String notify_url = "http://localhost:6896/pay";


    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
//	public static String return_url = "http://工程公网访问地址/alipay.trade.page.pay-JAVA-UTF-8/return_url.jsp";
    public static String return_url = "https://www.baidu.com/";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
//	public static String gatewayUrl = "https://openapi.alipay.com/gateway.do";
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
    // 支付宝网关
    public static String log_path = "C:\\";


    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     *
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis() + ".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}